# -*- coding: utf-8 -*-
# @Time    : 2022/5/19 18:42
# @Author  : 我还能卷
# @FileName: open_excel.py
# @Software: PyCharm

import openpyxl
from openpyxl.worksheet.worksheet import Worksheet
# 打开文件
f = openpyxl.load_workbook('wechat_testcase.xlsx')
print(f)
# 获取表格
sheet: Worksheet = f['朋友圈']
# 获取默认表格
# sheet2 = f.active
print(sheet)
# 获取表格中数据
print(sheet.cell(4, 5).value)
# 获取所有行数据
rows = list(sheet.values)
for row in rows:
    print(row)